package com.playball.lottery;

import android.app.Application;
import android.content.Context;
import android.util.Log;
import cn.jpush.android.api.JPushInterface;

import com.playball.lottery.util.UILImageLoader;
import com.qiyukf.unicorn.api.SavePowerConfig;
import com.qiyukf.unicorn.api.StatusBarNotificationConfig;
import com.qiyukf.unicorn.api.Unicorn;
import com.qiyukf.unicorn.api.YSFOptions;

/**
 * For developer startup JPush SDK
 * 
 * 一般建议在自定义 Application 类里初始化。也可以在主 Activity 里。
 */
public class ExampleApplication extends Application {

	private static Context context;

	@Override
	public void onCreate() {
		super.onCreate();
		ExampleApplication.context = getApplicationContext();
		Unicorn.init(this, "9832aa3ee732914fac4fe040288fbbc6", options(), new UILImageLoader());
		JPushInterface.setDebugMode(false);
        JPushInterface.init(this);
        JPushInterface.initCrashHandler(this);
	}

	// 如果返回值为null，则全部使用默认参数。
	private YSFOptions options() {
		YSFOptions options = new YSFOptions();
		options.statusBarNotificationConfig = new StatusBarNotificationConfig();
		options.savePowerConfig = new SavePowerConfig();
		return options;
	}


	public static Context getAppContext() {
		return ExampleApplication.context;
	}
}
